package com.wanxi.spring.cloud.words.controller;


import com.wanxi.spring.cloud.commons.api.CommonResult;
import com.wanxi.spring.cloud.words.model.Words;
import com.wanxi.spring.cloud.words.service.WordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 蒋帆
 * @since 2020-12-21
 */
@RestController
@RequestMapping("/words")
public class WordsController {

    @Autowired
    WordsService wordsService;

    @GetMapping("/getWords")
    public CommonResult getWords(@RequestParam Map map){
        return wordsService.getWords(map);
    }

    @GetMapping("/getSelfWords")
    public CommonResult getSelfWords(@RequestParam Map map){
        return wordsService.getSelfWords(map);
    }

    @PostMapping("/addWords")
    public CommonResult addWords(@RequestBody Words words){
        return wordsService.addWords(words);
    }

    @PostMapping("/editWords")
    public CommonResult editWords(@RequestBody Words words){
        return wordsService.editWords(words);
    }

    @GetMapping("/deleteWords")
    public CommonResult deleteWords(@RequestParam Integer id){
        return wordsService.deleteWords(id);
    }

    @GetMapping("/getUserLikeWords")
    public CommonResult getUserLikeWords(@RequestParam Map map){
        return wordsService.getUserLikeWords(map);
    }

    @GetMapping("/getUserCollectWords")
    public CommonResult getUserCollectWords(@RequestParam Map map){
        return wordsService.getUserCollectWords(map);
    }

    @GetMapping("/getUserWord")
    public CommonResult getUserWord(@RequestBody Words words){
        return wordsService.getUserWord(words);
    }
}
